// pages/ShopOwnerPages/memberList/memberList.js
Page({
  data: {
    pop_show: true,
    screenValues: [{
        text: '累计消费次数',
        checked: false
      },
      {
        text: '累计消费金额',
        checked: false
      },
    ],
    memberArr: [{
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
      {
        avatar: 'https://img01.yzcdn.cn/vant/cat.jpeg',
        name: '张三三',
        tel: '1368888888',
        cardId: '23131461643',
        createTime: '2021/05/20',
        recentCoseTime: '2021/05/20',
        costTimes: '20',
        allCost: '5200',
        allDiscount: '999',
      },
    ]
  },
  stopPopEvent() {},
  changePop() {
    this.setData({
      pop_show: !this.data.pop_show
    });
  },
  showPopup() {
    this.setData({
      pop_show: false
    });
  },
  ClosePop() {
    this.setData({
      pop_show: true
    });
  },
  cleanSearch() {
    this.setData({
      search_v: ''
    })
  },
  resetScreen() {
    let arr = this.data.screenValues
    for (let item of arr) {
      item.checked = false
    };
    this.setData({
      screenValues: arr
    })
  },
  changeScreen(e) {
    // console.log(e.currentTarget.dataset.index)
    let index = e.currentTarget.dataset.index;
    this.resetScreen();
    this.setData({
      [`screenValues[${index}].checked`]: true,
    })
  },
  confirmScreen() {
    this.ClosePop()
    //根据选中的类型筛选客户
  },

  openCard(e) {
    // console.log(e.currentTarget.dataset.index)
    let index = e.currentTarget.dataset.index
    this.setData({
      [`memberArr[${index}].body_show`]: this.data.memberArr[index].body_show ? !this.data.memberArr[index].body_show : true
    })
    // console.log(this.data.memberArr[index].body_show)
  },


  onLoad: function (options) {
    let app = getApp()
    this.setData({
      hoverHeight: app.globalData.windowHeight - app.globalData.navHeight,
      navHeight: app.globalData.navHeight,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})